﻿@model DTcms.Model.BaseModel
@{
    ViewBag.Title = "我的订单-" + Model.site.name;
    string templateskin = Model.templateskin;
    string action = Model.info["action"].ToString();
}
@section HeaderContent{

}
<!--当前位置-->
<div class="section">
    <div class="location">
        <span>当前位置：</span>
        <a href="@Html.linkurl("index")">首页</a> &gt;
        <a href="@Html.linkurl("usercenter","index")">会员中心</a>
        <a href="@Html.linkurl("userorder","list")">我的订单</a>
    </div>
</div>
<!--/当前位置-->

<div class="section clearfix">
    <!--页面左边-->
    @Html.Partial("_ucenter_nav")
    <!--/页面左边-->
    <!--页面左边-->
    <div class="right-auto">
        <div class="bg-wrap" style="min-height:765px;">
            <div class="sub-tit">
                    <a class="add" href="javascript:history.go(-1);"><i class="iconfont icon-reply"></i>返回</a>
                    <ul>
                        <li class="@(action=="list"?"selected":"")">
                            <a href="@Html.linkurl("userorder", "list")">交易订单</a>
                        </li>
                        <li class="@(action=="close"?"selected":"")">
                            <a href="@Html.linkurl("userorder", "close")">已关闭订单</a>
                        </li>
                    </ul>
                </div>

                <div class="table-wrap">
                    <table class="layui-table" lay-data="{page:true, id:'ltable'}" lay-filter="ltable">
                        <thead>
                            <tr>
                                <th lay-data="{checkbox:true}"></th>
                                <th lay-data="{field:'order_no'}">订单号</th>
                                <th lay-data="{field:'post_time',templet:'#goods_list'}">订单商品</th>
                                <th lay-data="{field:'accept_name'}">姓名</th>
                                <th lay-data="{field:'order_amount',templet:'#amount'}">订单金额</th>
                                <th lay-data="{field:'add_time'}">下单时间</th>
                                <th lay-data="{field:'status_title'}">状态</th>
                                <th lay-data="{templet: '#barDemo'}">操作</th>
                            </tr>
                        </thead>
                    </table>
                </div>
        </div>
    </div>
    <!--/页面左边-->
</div>
<script type="text/html" id="goods_list">
    {{#  layui.each(d.goods_list, function(index, item){ }}
    <a target="_blank" title="{{item.title}}" href="/goods/show-{{item.id}}.html">
        <img width="60" height="60" alt="{{item.title}}" src="{{item.img_url}}" class="img">
    </a>
  {{#  }); }}
</script>
<script type="text/html" id="amount">
    <strong>￥{{d.order_amount}}</strong><br />{{d.payment_title}}
</script>
<script type="text/html" id="barDemo">
    <a href="/user/order/show-{{d.id}}.html">查看订单</a><br />
    {{d.payment_status==1?'<a href="/payment.html?action=confirm&order_no=d.order_no">去付款</a>':''}}
    {{d.status<2?'<a href="javascript:;" onclick="clickSubmit('/api/submit_ajax/order_cancel?order_no=d.order_no');">取消</a>':''}}
</script>
@section Scripts{
    <script type="text/javascript">
        layui.use(['table', 'myaspx'], function () {
            var table = layui.table, os = layui.myaspx;
            // 渲染表格
            os.dataBind('/api/lisence_ajax/get_order_list?action=@action');

            //监听行工具事件
            table.on('tool(ltable)', function (obj) {
                var data = obj.data;
                if (obj.event === 'del') {
                    layer.confirm('确认操作吗？', function (index) {
                        cmswh.request("user_message_delete", "POST", { checkId: data.id });
                        obj.del();
                        layer.close(index);
                    });
                }
            });
        });
    </script>
}